#include <stdio.h>
#define X 100

int max_array(int *arr,int n)
{
	int max = arr[0];
	int now = arr[0];
	for(int i = 1;i < n;i++)
	{
		now += arr[i];
		if(now > max)
		{
			max = now;
		}
		if(now < arr[i])
		{
			now = arr[i];
		}
	}
	return max;
}

int main()
{
	int arr[X];
	for(int i = 0;i < X;i++)
	{
		scanf("%d",&arr[i]);
	}
	printf("%d\n",max_array(arr,X));
	return 0;
}
